package com.cade.agriculturemall.view.shoppingCar.settlement.TicketSelectDialog;

import android.content.Context;
import android.support.v7.app.AppCompatDialog;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.Button;

import com.cade.agriculturemall.R;

/**
 * Created by hshunxin on 2018/2/27.
 */

public class TicketSelectDialog extends AppCompatDialog implements View.OnClickListener {
    private DialogClick myClickListener;
    TicketSelectAdapter adapter = new TicketSelectAdapter();

    public TicketSelectDialog(Context context, DialogClick myClickListener) {
        super(context);
        this.myClickListener = myClickListener;
        init();

    }

    private void init() {
        setContentView(R.layout.layout_ticket_select);
        RecyclerView recyclerView = (RecyclerView) findViewById(R.id.ticket_select_recyclerview);
        recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
        recyclerView.setAdapter(adapter);
        Button btn = (Button) findViewById(R.id.ticket_select_dialog_btn);
        btn.setOnClickListener(this);
    }


    public TicketSelectAdapter getAdapter() {
        return adapter;
    }

    @Override
    public void onClick(View view) {
        myClickListener.dialogClick(view);

    }


    public interface DialogClick {
        void dialogClick(View view);
    }
}
